<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="纪德朝">
    <title>jQuery下拉菜单</title>
    <style>
        nav {
            width: 100%;
            height: 50px;
            background-color: lightgrey;
        }

        .container {
            text-align: center;
            width: 1000px;
            margin: 0 auto;
            height: 50px;
            line-height: 50px;
            background-color: gray;
            display: flex;
            justify-content: center;
            font-size: 20px;
        }

        a {
            text-decoration: none;
            color: white;
        }

        ul,li {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .container>li{
            width: 150px;
            margin-left: 50px;
        }
        .active a{
            color: gray;
        } 
        .active li{
            margin-left: 25px;
             width: 100px; 
        }
        .active{
            /* border: 1px solid black; */
            display: none;
        }
    </style>
</head>

<body>
    <nav>
        <ul class="container">
            <li>
                <a href="#" class="color">公司简介</a>
                <ul class="active">
                    <li><a href="#">概况介绍</a></li>
                    <li><a href="#">发展历史</a></li>
                    <li><a href="#">公司实力</a></li>
                </ul>
            </li>
            <li>
                <a href="#" class="color">产品介绍</a>
                <ul class="active">
                    <li><a href="#">软件开发</a></li>
                    <li><a href="#">软件教育</a></li>
                    <li><a href="#">天使投资</a></li>
                </ul>
            </li>
            <li>
                <a href="#" class="color">联系我们</a>
                <ul class="active">
                    <li><a href="#">公司地址</a></li>
                    <li><a href="#">联系方式</a></li>
                    <li><a href="#">投资加盟</a></li>
                </ul>
            </li>
            <li>
                <a href="#" class="color">人才招聘</a>
                <ul class="active">
                    <li><a href="#">Java招聘</a></li>
                    <li><a href="#">html5招聘</a></li>
                    <li><a href="#">PHP招聘</a></li>
                </ul>
            </li>
        </ul>
    </nav>
    <script src="./js/jquery.js"></script>
</body>
<script>
    var lis = $('.container>li')
    $(lis).each(function(index){
        $(this).mouseover (function(){
            $('.color').eq(index).css('text-decoration','underline').css('color','orange');
            $('.active').eq(index).css('display','block').css('border','1px solid gray');            
        });
        $(this).mouseout (function(){
            $('.color').eq(index).css('text-decoration','none').css('color','');
            $('.active').eq(index).css('display','none');
        });        
    });    
    $('.active a').each(function(index){
        $(this).mouseover(function(){
            $('.active a').eq(index).css('text-decoration','underline');
        });
        $(this).mouseout(function(){
            $('.active a').eq(index).css('text-decoration','none');
        });
    });
</script>

</html>